/**
 *                     Remixvym (version 0.8.3)
 *             Copyright (c) 2010 by RemixLab, DISI-UNAL
 *            http://www.disi.unal.edu.co/grupos/remixlab/
 *
 * This Java package provides classes to visualize Mind Maps created in VYM
 * (View Your Mind) in a Processing Sketch
 *
 * @author Alvaro Lopez, Juan Baquero
 *
 * This source file is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option)
 * any later version.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * A copy of the GNU General Public License is available on the World Wide Web
 * at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by
 * writing to the Free Software Foundation, 51 Franklin Street, Fifth Floor
 * Boston, MA 02110, USA
 */
package remixlab.remixvym;

//import processing.xml.XMLElement;
import remixlab.remixvym.core.mindmap.Node;
import remixlab.remixvym.xml.XMLReader;


/** This class is the object representation of a VYM map
 * */
/**Specific constructor, use render P2D, set the size of sketch and set a custom Style. 
 * Use the default Algorithm Selection (TRIANGLE) 
 * and the default ScaleMode (REAL). This constructor specify the custom Style ({@link remixlab.remixvym.core.graphics.StyleGraph}).
 * <br><br><br>
 * 	  
 * <b>See Examples:</b> Colors, LineStyle and NodeStyle<br><br>
 * 
 * @param ap The sketch reference
 * @param wx Width of Scene
 * @param hy Height of Scene
 * @param style Custom Style
 */
public class MindMap {
	private Node root;
	private int width;
	private int height;
	private int widthOriginal;
	private int heightOriginal;
	private double scale;
	private String url;

	public MindMap()
	{}
	
	/**
	 * Constructor. Sets the XML path builded from VYM. Initiates the root of the XML file.
	 * @param urlFile Path
	 * @param xml Process the XML file.
	 */
	public void create(String urlFile,XMLReader xml)
	{
		url = urlFile;
		xml.setupFile(urlFile);
		root = xml.getRoot();
	}

	/**
	 * Constructor. Sets the XML path builded from VYM using our XMLReader implementation. 
	 * Initiates the root of the XML file.
	 * @param urlFile Path
	 * @param xml Name the XML file.
	 * @param xmlReader Process the XML file.
	 */
	public void create(String file,String xml,PXMLReader xmlReader) {
		url = file;
		xmlReader.setupXML2(xml);
		root = xmlReader.getRoot();
	}

	/**Returns the root of the XML file.*/
	public Node getMap()
	{
		return root;
	}
	/**Returns the map size.*/
	public int getWidth() {
		return width;
	}
	/**Sets the map width.*/
	public void setWidth(int width) {
		this.width = width;
	}
	/**Returns the map height.*/
	public int getHeight() {
		return height;
	}
	/**Sets the height of the XML file.*/
	public void setHeight(int height) {
		this.height = height;
	}
	/**Sets the original map width.*/
	public void setWidthOriginal(int widthOriginal) {
		this.widthOriginal = widthOriginal;
	}
	/**Returns the original map width.*/
	public int getWidthOriginal() {
		return widthOriginal;
	}
	/**Sets the original map height.*/
	public void setHeightOriginal(int heightOriginal) {
		this.heightOriginal = heightOriginal;
	}
	/**Returns the original map height.*/
	public int getHeightOriginal() {
		return heightOriginal;
	}
	/**Returns the original map scale.*/
	public double getScale() {
		return scale;
	}
	/**Sets the original map scale.*/
	public void setScale(double scale) {
		this.scale = scale;
	}
	/**Returns the XML path.*/
	public String getUrl()
	{
		return url;
	}
}
